package exam.huawei;

import java.util.Scanner;

/**
 * @author chenhong
 * @version 1.0
 * @description 跟lc5一样
 * @date 2023/4/15 10:21
 */
public class HJ32 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        for (int i = 0,j = str.length() - 1 ; i < str.length() && j>= 0; i++,j--) {
            if (isSymmetry(str, i, str.length() - 1)) {
                System.out.println(str.length() - i);
                break;
            }
            if (isSymmetry(str, 0, j)){
                System.out.println( j + 1);
                break;
            }

        }
    }

    public static boolean isSymmetry(String str, int startIndex, int endIndex) {
        for (int i = startIndex, j = endIndex; i <= j; i++, j--) {
            if (str.charAt(i) != str.charAt(j)) {
                return false;
            }
        }
        return true;
    }
}
